package ZuoYe.I;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 查询界面
 */
public class SearchPanel extends JPanel implements ActionListener {
    private ATMFrame atmFrame;
    private JLabel blanceLabel = new JLabel();
    private JLabel getmoneyLabel = new JLabel("余额:");
    private ImageIcon sureImg= new ImageIcon("picture/buttonSure.jpg");
    private Font font = new Font("微软雅黑",Font.BOLD,25);
    private JButton sureBth= new JButton(sureImg);
    public SearchPanel(ATMFrame atmFrame){
        this.atmFrame = atmFrame;
        this.setLayout(null);
        sureBth.setBounds(400,350,150,50);
        sureBth.addActionListener(this);
        getmoneyLabel.setBounds(350,200,100,50);
        blanceLabel.setBounds(450,200,100,50);
        getmoneyLabel.setFont(font);
        blanceLabel.setFont(font);
        this.add(getmoneyLabel);
        this.add(sureBth);
        this.add(blanceLabel);
        this.setOpaque(false);
    }
    public void showBlance(){
        blanceLabel.setText( atmFrame.getLoginUser().getBlance()+"");
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource()==sureBth){
            atmFrame.switchPanel("menu");
        }
    }
}
